#pragma config(Sensor, in1,    lnLeft,         sensorLineFollower)
#pragma config(Sensor, in2,    lnMid,          sensorLineFollower)
#pragma config(Sensor, in3,    lnRight,        sensorLineFollower)
#pragma config(Sensor, dgtl1,  snsBall,        sensorTouch)
#pragma config(Sensor, dgtl2,  encLeft,        sensorQuadEncoder)
#pragma config(Sensor, dgtl4,  encRight,       sensorQuadEncoder)
#pragma config(Sensor, dgtl6,  snsFront,       sensorSONAR_inch)
#pragma config(Motor,  port2,           leftWheels,    tmotorServoContinuousRotation, openLoop, reversed)
#pragma config(Motor,  port3,           rightWheels,   tmotorServoContinuousRotation, openLoop)
#pragma config(Motor,  port4,           treads,        tmotorServoContinuousRotation, openLoop)
#pragma config(Motor,  port5,           blocker,       tmotorServoStandard, openLoop)

task main()
{
  bool hasBall=false;
  int numBumps=0;
  motor[blocker]=-115;
  wait1Msec(1000);

  while(true)
  {
    motor[leftWheels]  = vexRT[Ch3];   // Left Joystick Y value
    motor[rightWheels] = vexRT[Ch2];   // Right Joystick Y value

    if(vexRT[Btn8R])
    {
      motor[treads]=127;
    }

    else
    {
      motor[treads]=0;
    }



    if(vexRT[Btn7L])
    {
      motor[blocker]=127;
    }

    if(vexRT[Btn7R])
    {
      motor[blocker]=-115;
    }

  }
  if(SensorValue(snsBall)==1)
  {
    numBumps++;
    wait1Msec(20);
  }

  if(numBumps>=5)
    hasBall=true;
  else
    hasBall=false;


}
